#include "NTL/ZZ.h"
#include "struct_pack.hpp"

#include <string_view>

namespace NTL {
std::size_t get_needed_size(NTL::ZZ &z) {
    return sizeof(uint64_t) + NTL::BytesFromZZ(z);
};
template <struct_pack::writer_t writer_t>
void serialize_to(writer_t writer, const ZZ &z) {
    //std::vector<unsigned char> buf(NTL::NumBytes(z));
    //NTL::BytesFromZZ(buf.data(), z, static_cast<long>(buf.size()));
    //uint64_t sz = buf.size();
    //struct_pack::write(writer, sz);
    //struct_pack::write(writer, buf.data(), buf.size());
}
template <struct_pack::reader_t reader_t>
void deserialize_to(reader_t reader, ZZ &z) {
    //uint64_t sz;
    //struct_pack::read(reader, sz);
    //std::string_view buf;
    //if constexpr (requires { reader.read_view(std::size_t{}); }) {
    //    buf = reader.read_view(sz);
    //} else {
    //    std::vector<unsigned char> tmp;
    //    buf.resize(sz);
    //    struct_pack::read(reader, tmp.data(), tmp.size());
    //    buf = { tmp.data(), tmp.size() }
    //}
    //NTL::ZZFromBytes(z, buf.data(), static_cast<long>(buf.size()));
}
} // namespace NTL

int main() {
    NTL::ZZ zz(1000);

    auto buffer2 = struct_pack::serialize<std::string>(zz);
    auto zz2 = struct_pack::deserialize<NTL::ZZ>(buffer2);
}
